﻿///////////////////////////////////////////////////////////////
// This is generated code. 
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 2.6
// Code is generated on: 2011年7月5日 11:37:43
// Code is generated using templates: SD.TemplateBindings.SharedTemplates.NET20
// Templates vendor: Solutions Design.
// Templates version: 
//////////////////////////////////////////////////////////////
using System;
using System.Collections;
using System.Collections.Generic;
using CARMSData;
using CARMSData.FactoryClasses;
using CARMSData.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;

namespace CARMSData.RelationClasses
{
	/// <summary>Implements the static Relations variant for the entity: Template. </summary>
	public partial class TemplateRelations
	{
		/// <summary>CTor</summary>
		public TemplateRelations()
		{
		}

		/// <summary>Gets all relations of the TemplateEntity as a list of IEntityRelation objects.</summary>
		/// <returns>a list of IEntityRelation objects</returns>
		public virtual List<IEntityRelation> GetAllRelations()
		{
			List<IEntityRelation> toReturn = new List<IEntityRelation>();
			toReturn.Add(this.MessageEntityUsingTemplateId);
			toReturn.Add(this.ReportCategoryToTemplateEntityUsingTemplateId);
			toReturn.Add(this.TemplateToReportCategoryEntityUsingTemplateId);

			toReturn.Add(this.ActionEntityUsingShowActionId);
			return toReturn;
		}

		#region Class Property Declarations

		/// <summary>Returns a new IEntityRelation object, between TemplateEntity and MessageEntity over the 1:n relation they have, using the relation between the fields:
		/// Template.TemplateId - Message.TemplateId
		/// </summary>
		public virtual IEntityRelation MessageEntityUsingTemplateId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "Message" , true);
				relation.AddEntityFieldPair(TemplateFields.TemplateId, MessageFields.TemplateId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TemplateEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("MessageEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between TemplateEntity and ReportCategoryToTemplateEntity over the 1:n relation they have, using the relation between the fields:
		/// Template.TemplateId - ReportCategoryToTemplate.TemplateId
		/// </summary>
		public virtual IEntityRelation ReportCategoryToTemplateEntityUsingTemplateId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "ReportCategoryToTemplate" , true);
				relation.AddEntityFieldPair(TemplateFields.TemplateId, ReportCategoryToTemplateFields.TemplateId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TemplateEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ReportCategoryToTemplateEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between TemplateEntity and TemplateToReportCategoryEntity over the 1:n relation they have, using the relation between the fields:
		/// Template.TemplateId - TemplateToReportCategory.TemplateId
		/// </summary>
		public virtual IEntityRelation TemplateToReportCategoryEntityUsingTemplateId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "TemplateToReportCategory" , true);
				relation.AddEntityFieldPair(TemplateFields.TemplateId, TemplateToReportCategoryFields.TemplateId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TemplateEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TemplateToReportCategoryEntity", false);
				return relation;
			}
		}


		/// <summary>Returns a new IEntityRelation object, between TemplateEntity and ActionEntity over the m:1 relation they have, using the relation between the fields:
		/// Template.ShowActionId - Action.ActionId
		/// </summary>
		public virtual IEntityRelation ActionEntityUsingShowActionId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne, "Action", false);
				relation.AddEntityFieldPair(ActionFields.ActionId, TemplateFields.ShowActionId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ActionEntity", false);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TemplateEntity", true);
				return relation;
			}
		}

		/// <summary>stub, not used in this entity, only for TargetPerEntity entities.</summary>
		public virtual IEntityRelation GetSubTypeRelation(string subTypeEntityName) { return null; }
		/// <summary>stub, not used in this entity, only for TargetPerEntity entities.</summary>
		public virtual IEntityRelation GetSuperTypeRelation() { return null;}

		#endregion

		#region Included Code

		#endregion
	}
}
